import { useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import StorageManager from "@/utils/StorageManager";
import { message } from "antd";

export const useRouteMonitor = () => {
  const location = useLocation();
  const navigate = useNavigate();

  useEffect(() => {
    // if (location.pathname.includes("login")) return;
    // console.log("Current route:", location.pathname);
    // const token = StorageManager.getSessionStorageSync("storage-token");
    // if (!token) {
    //   if (!location.pathname.includes("login")) {
    //     navigate("/login");
    //     message.info("请先进行登录");
    //   }
    // }
  }, [location]);
};
